﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Vitruvian.Distribution;
using Vitruvian.Distribution.SyncPatterns;
using Vitruvian.Serialization;
using Vitruvian.Logging;
using Vitruvian.Testing;

namespace SpotItComponents
{
    [ContainsTests("Components.UserStuff")]
    [OptimisticSerialization]
    public class UserAccount : IComparable
    {
        #region Constructors
        public UserAccount()
        {
            Id = Guid.NewGuid();
            IsAdmin = false;
            IsDesigner = false;
        }

        public UserAccount(string username, string password, string fullName, string email)
        {
            Id = Guid.NewGuid();
            Username = username;
            Password = password;
            FullName = fullName;
            Email = email;
            IsAdmin = false;
            IsDesigner = false;
        }
        #endregion

        #region Public Properties and Methods
        public virtual Guid Id { get; set; }
        public virtual string Username { get; set; }
        public virtual string Password { get; set; }
        public virtual string FullName { get; set; }
        public virtual string Email { get; set; }
        public virtual bool IsDesigner { get; set; }
        public virtual bool IsAdmin { get; set; }
        #endregion

        #region Method for IComparable Interface
        public int CompareTo(object obj)
        {
            int result = 1;
            if (obj != null && obj.GetType() == typeof(UserAccount))
            {
                UserAccount otherUserAccount = obj as UserAccount;
                result = this.Id.CompareTo(otherUserAccount.Id);
            }
            return result;
        }
        #endregion
    }
}
